<!DOCTYPE html>
<html  xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="common/head :: htmlhead">
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">其他单位信息</div>
                <div class="layui-card-body">
                    <form class="layui-form" action="" lay-filter="component-form-element">
                        <div hidden>
                            <input type="text" name="id" lay-verify="required" hidden="hidden" th:value="${oth.id}" autocomplete="off" class="layui-input">
                        </div>
                        <!--第一行：名称和类型-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">单位名称</label>
                                <div class="layui-input-block">
                                    <input type="text" name="name" lay-verify="required" disabled th:value="${oth.name}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">单位类型</label>
                                <div class="layui-input-block">
                                    <select name="unittype" id="unittype" lay-verify="required" disabled>
                                        <option value=""></option>
                                        <option value="0" th:selected="${oth.unittype}==0?'selected':null">有限责任公司</option>
                                        <option value="1" th:selected="${oth.unittype}==1?'selected':null">股份有限公司</option>
                                        <option value="2" th:selected="${oth.unittype}==2?'selected':null">其他企业法人</option>
                                        <option value="3" th:selected="${oth.unittype}==3?'selected':null">个人独资企业</option>
                                        <option value="4" th:selected="${oth.unittype}==4?'selected':null">合伙企业</option>
                                        <option value="5" th:selected="${oth.unittype}==5?'selected':null">不具有法人资格的专业服务机构</option>
                                        <option value="6" th:selected="${oth.unittype}==6?'selected':null">事业单位</option>
                                        <option value="7" th:selected="${oth.unittype}==7?'selected':null">社会团体</option>
                                        <option value="8" th:selected="${oth.unittype}==8?'selected':null">基金会</option>
                                        <option value="9" th:selected="${oth.unittype}==9?'selected':null">社会服务机构</option>
                                        <option value="10" th:selected="${oth.unittype}==10?'selected':null">机关法人</option>
                                        <option value="11" th:selected="${oth.unittype}==11?'selected':null">农村集体经济组织法人</option>
                                        <option value="12" th:selected="${oth.unittype}==12?'selected':null">城镇农村的合作经济组织法人</option>
                                        <option value="13" th:selected="${oth.unittype}==13?'selected':null">基层群众性自治组织法人</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <!--第二行：联系人和职务-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">联系人</label>
                                <div class="layui-input-block">
                                    <input type="text" name="linker" lay-verify="required" disabled th:value="${oth.linker}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">职务</label>
                                <div class="layui-input-block">
                                    <input type="text" name="linkerjob" lay-verify="required" disabled th:value="${oth.linkerjob}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第三行：手机座机-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">手机</label>
                                <div class="layui-input-block">
                                    <input type="text" name="mobilephone" lay-verify="required|phone" disabled th:value="${oth.mobilephone}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">座机</label>
                                <div class="layui-input-block">
                                    <input type="text" name="phone" lay-verify="required" disabled th:value="${oth.phone}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第四行：邮箱邮编-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">电子邮箱</label>
                                <div class="layui-input-block">
                                    <input type="text" name="email" lay-verify="required|email" disabled th:value="${oth.email}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">邮编</label>
                                <div class="layui-input-block">
                                    <input type="number" name="postcode" lay-verify="required" disabled th:value="${oth.postcode}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第五行：地址-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6" id="area-picker">
                                <label class="layui-form-label">省市</label>
                                <div class="layui-input-inline layui-col-lg3">
                                    <select name="province" id="province" class="province-selector" lay-filter="province-1" disabled>
                                        <option th:value="${oth.province}" th:text="${oth.province}" selected="selected"></option>
                                    </select>
                                </div>
                                <div class="layui-input-inline layui-col-lg3" >
                                    <select name="city" id="city" class="city-selector" lay-filter="city-1" disabled>
                                        <option th:value="${oth.city}" th:text="${oth.city}" selected="selected"></option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-col-lg4">
                                <label class="layui-form-label">详细地址</label>
                                <div class="layui-input-block">
                                    <input type="text" name="address" lay-verify="required" disabled th:value="${oth.address}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第六行：成立时间、注册资本-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">成立时间</label>
                                <div class="layui-input-block">
                                    <input type="text" name="founddate" lay-verify="required" disabled th:value="${oth.founddate}"
                                           autocomplete="off" class="layui-input" id="date1">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">注册资本（万元）</label>
                                <div class="layui-input-block">
                                    <input type="number" name="registerasset" lay-verify="required" disabled th:value="${oth.registerasset}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第七行：法人代表、统一社会信用代码-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">法人代表</label>
                                <div class="layui-input-block">
                                    <input type="text" name="faren" lay-verify="required" disabled th:value="${oth.faren}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">  统一社会信用代码</label>
                                <div class="layui-input-block">
                                    <input type="text" name="creditcode" lay-verify="required" disabled th:value="${oth.creditcode}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第八行：官网、组织机构代码-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">官网</label>
                                <div class="layui-input-block">
                                    <input type="text" name="officialweb" lay-verify="required" disabled th:value="${oth.officialweb}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">组织机构代码</label>
                                <div class="layui-input-block">
                                    <input type="text" name="groupid" lay-verify="required" disabled th:value="${oth.groupid}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--&lt;!&ndash;第九行：核准日期、登记机关&ndash;&gt;
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">核准日期</label>
                                <div class="layui-input-block">
                                    <input type="text" name="approvaldate" lay-verify="required" disabled th:value="${#dates.format(oth.approvaldate, 'yyyy-MM-dd')}"
                                           autocomplete="off" class="layui-input" id="date2">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">登记机关</label>
                                <div class="layui-input-block">
                                    <input type="text" name="registeroffice" lay-verify="required"disabled th:value="${oth.registeroffice}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        &lt;!&ndash;第十行：营业期限、经营状态&ndash;&gt;
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">营业期限</label>
                                <div class="layui-input-block">
                                    <input type="text" name="operationperiod" lay-verify="required" disabled th:value="${oth.operationperiod}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">经营状态</label>
                                <div class="layui-input-block">
                                    <input type="text" name="operatestatus" lay-verify="required" disabled th:value="${oth.operatestatus}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        &lt;!&ndash;第十一行：面临问题&ndash;&gt;
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg10">
                                <label class="layui-form-label">面临问题</label>
                                <div class="layui-input-block">
                                    <input type="text" name="question" lay-verify="required" disabled th:value="${oth.question}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>-->
                        <!--第十二行： 从业人数-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">从业人数</label>
                                <div class="layui-input-block">
                                    <input type="number" name="employeenum" lay-verify="required" disabled th:value="${oth.employeenum}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第十三行：所属行业-->
                        <!--<div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg10">
                                <label class="layui-form-label">所属行业</label>
                                <div class="layui-input-block">
                                    <input class="layui-input" disabled th:value="${oth.industrytype}" lay-verify="required">
                                    <input type="hidden" id="hangyetag" value="0">
                                </div>
                            </div>
                        </div>-->
                        <!--第十四行：业务范围-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg10">
                                <label class="layui-form-label">业务范围</label>
                                <div class="layui-input-block">
                                    <input type="text" name="businessrange" lay-verify="required" disabled th:value="${oth.businessrange}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第十五行：单位介绍-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg10">
                                <label class="layui-form-label">单位介绍</label>
                                <div class="layui-input-block">
                                    <textarea name="groupintroduct" disabled th:text="${oth.groupintroduct}" class="layui-textarea"></textarea>
                                </div>
                            </div>
                        </div>
                        <input type="hidden" id="userid"  th:value="${oth.userid}" class="layui-input">
                        <!--注册资料页面显示-->
                        <div class="layui-form-item" th:hidden="${page}=='register'?false:true">
                            <div class="layui-input-block" id="btn_m">
                                <button class="layui-btn" id="modify" type="button">修改</button>
                            </div>
                            <div class="layui-input-block" hidden="true" id="btn_s">
                                <button class="layui-btn" id="submit" lay-submit lay-filter="formsubmit">提交</button>
                            </div>
                        </div>
                        <!--注册审核页面显示-->
                        <div class="layui-form-item" th:hidden="${page}=='check'?false:true">
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-lg10">
                                    <label class="layui-form-label">审核文件</label>
                                    <div class="layui-input-block">
                                        <a target="_blank" th:href="'../'+${file1.getFileid()}">审核文件</a>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-row layui-col-space10 layui-form-item" th:hidden="${file2}==null?true:false">
                                <div class="layui-col-lg10">
                                    <label class="layui-form-label">其他文件</label>
                                    <div class="layui-input-block">
                                        <a target="_blank" th:href="${file2}==null?null:${'../'+file2.getFileid()}">其他文件</a>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-input-block">
                                <button class="layui-btn" id="tongguo" type="button">审核通过并分配角色</button>
                                <button class="layui-btn layui-btn-danger" id="butongguo" type="button">审核不通过</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<!--审核通过弹框-->
<div class="site-text" style="margin: 5%; display: none" id="check_tg">
    <div class="layui-form" action="" lay-filter="check_tg_form">
        <input type="hidden" name="id" id="userid_r" class="layui-input" >
        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-block" id="mycheckbox">

            </div>
        </div>
        <div class="layui-form-item" hidden>
            <div class="layui-input-block">
                <button id="check_tg_submit" class="layui-btn" lay-submit lay-filter="check_tg_submit">
                    审核通过
                </button>
            </div>
        </div>
    </div>
</div>
<!--审核不通过弹框-->
<div class="site-text" style="margin: 5%; display: none" id="check_butg">
    <div class="layui-form" action="" lay-filter="check_butg_form">
        <input type="hidden" name="id" id="userid_b" class="layui-input" >
        <div class="layui-form-item">
            <label class="layui-form-label">审核意见</label>
            <div class="layui-input-block">
                <textarea name="shenheyijian" lay-verify="required" autocomplete="off" placeholder="请输入审核意见" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item" hidden>
            <div class="layui-input-block">
                <button id="check_butg_submit" class="layui-btn" lay-submit lay-filter="check_butg_submit">
                    审核不通过
                </button>
            </div>
        </div>
    </div>
</div>
<script>
    layui.config({
        base: '/static/lib/' //静态资源所在路径
    }).extend({
        index: 'index' //主入口模块
    }).use(['index', 'form','layarea','laydate'], function(){
        var admin = layui.admin
            ,element = layui.element
            ,layer = layui.layer
            ,form = layui.form
            ,layarea = layui.layarea
            , laydate = layui.laydate
            ,$ = layui.jquery;

        $('#modify').click(function () {
            $('input').removeAttr("disabled");
            $('textarea').removeAttr("disabled");
            $('#province').removeAttr("disabled");
            $('#city').removeAttr("disabled");
            $('#unittype').removeAttr("disabled");
            $('#btn_m').attr("hidden",true);
            $('#btn_s').attr("hidden",false);
            form.render("select");
            $("html,body").animate({"scrollTop":0});

        });

        layarea.render({
            elem: '#area-picker',
            data:{
                province: $("#province").val(),
                city: $("#city").val()
            },
            change: function (res) {
                //选择结果
                console.log(res);
            }

        });
        laydate.render({
            elem: '#date1' //指定元素
            ,format:'yyyy/MM/dd'
            ,value: $("#date1").val()//默认值
        });


        form.render(null, 'formsubmit');
        element.render('breadcrumb', 'breadcrumb');

        form.on('submit(formsubmit)', function(data){
            $.ajax({
                url:"/xqmodify_oth/register",
                async: false,
                type:"POST",
                dataType: "text",
                data:data.field,
                success: function(data){
                    if(data==="success_oth"){
                        layer.open({
                            title: '修改成功'
                            ,content: '信息已修改！'
                            ,yes: function(index, layero){
                                window.parent.location.reload();
                            }
                        });
                    }
                }
            });
            return false;
        });

        $('#tongguo').click(function () {
            layer.open({
                type: 1
                ,skin: 'layui-layer-molv'
                ,area: ['40%', '60%']
                ,title: ['请选择要分配的角色','font-size:18px']
                ,btn: ['通过并分配角色', '取消']
                ,shadeClose: true
                ,shade: 0 //遮罩透明度
                ,maxmin: true //允许全屏最小化
                ,content:$("#check_tg")  //弹窗路径
                ,success:function(layero,index){
                    $.ajax({
                        url:"/getRoleList",
                        async: false,
                        type:"POST",
                        dataType: "text",
                        success: function(res){
                            var roleList = jQuery.parseJSON(res).roleList;
                            if(roleList&&roleList.length>0){
                                for(var i = 0; i < roleList.length;i++){
                                    var roleid = roleList[i].id;
                                    var rolename = roleList[i].name;
                                    $("#mycheckbox").append("<input name='role' type='checkbox' lay-skin='primary' title='"+rolename+"' value='"+roleid+"' ><br>");
                                }
                            }
                        }
                    });
                    $("#userid_r").attr("value",$('#userid').val());
                    form.render(null, 'check_tg_form');

                }
                ,yes : function(index, layero) { // 确认按钮回调函数
                    form.on('submit(check_tg_submit)', function(data) {
                        if ($("input:checkbox[name='role']:checked").length == 0) {
                            alert("请先选择要分配的角色");
                            return;
                        }

                        var role_list = new Array();
                        $("input:checkbox[name='role']:checked").each(function(i){
                            role_list[i] = $(this).val();
                        });
                        data.field.role = role_list.join(",");
                        console.log(data.field);
                        $.ajax({
                            url:"/registercheck/tongguo",
                            async: false,
                            type:"POST",
                            dataType: "text",
                            data:data.field,
                            success: function(data){
                                if(data==="error"){
                                    layer.close(index);
                                    layer.msg('审核失败！', {icon: 2});
                                }else if(data==="success"){
                                    layer.msg('审核成功！', {icon: 1});
                                    setTimeout("",1000);
                                    self.location="/register_check_list";
                                }
                            }
                        });
                        return false;
                    });
                    $('#check_tg_submit').click();

                }
                ,btn2 : function(index, layero) { // 取消按钮回调函数
                    layer.close(index); // 关闭弹出层
                }
            });
        });


        $('#butongguo').click(function () {
            layer.open({
                type: 1
                ,skin: 'layui-layer-molv'
                ,area: ['40%', '40%']
                ,title: ['请填写审核意见','font-size:18px']
                ,btn: ['审核不通过', '取消']
                ,shadeClose: true
                ,shade: 0 //遮罩透明度
                ,maxmin: true //允许全屏最小化
                ,content:$("#check_butg")  //弹窗路径
                ,success:function(layero,index){
                    $("#userid_b").attr("value",$('#userid').val());
                    form.render(null, 'check_butg_form');
                }
                ,yes : function(index, layero) { // 确认按钮回调函数
                    form.on('submit(check_butg_submit)', function(data) {
                        $.ajax({
                            url:"/registercheck/butongguo",
                            async: false,
                            type:"POST",
                            dataType: "text",
                            data:data.field,
                            success: function(data){
                                if(data==="error"){
                                    layer.close(index);
                                    layer.msg('审核失败！', {icon: 2});
                                }else if(data==="success"){
                                    layer.msg('审核成功！', {icon: 1});
                                    setTimeout("",1000);
                                    self.location="/register_check_list";
                                }
                            }
                        });
                        return false;
                    });
                    $('#check_butg_submit').click();

                }
                ,btn2 : function(index, layero) { // 取消按钮回调函数
                    layer.close(index); // 关闭弹出层
                }
            });
        });
    });
</script>
<script type="text/javascript" src="/static/js/hangye.js"></script>
</body>
</html>